package com.mf.entity.req.basic.webPage;

import com.mf.emuns.basic.EnumPageJsonType;
import com.mf.groups.GroupsAddInterface;
import com.mf.groups.GroupsUpdateInterface;
import com.mf.valid.ValidEnumValue;
import com.mf.valid.ValidListValue;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author: lmf
 * @Create: 2025/5/4 14:34
 * @module
 */
@Data
public class ReqPageItem implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "id不能为空", groups = {GroupsUpdateInterface.class})
    @Null(message = "新增id必须为空", groups = {GroupsAddInterface.class})
    private Integer id;

    @NotNull(message = "页面id不能为空", groups = {GroupsUpdateInterface.class, GroupsAddInterface.class})
    @Schema(description = "页面id")
    private Integer pageId;

    @NotNull(message = "jsonId不能为空", groups = {GroupsUpdateInterface.class, GroupsAddInterface.class})
    @Schema(description = "jsonId")
    private Integer jsonId;

    @NotBlank(message = "type不能为空", groups = {GroupsUpdateInterface.class, GroupsAddInterface.class})
    @ValidEnumValue(enumClass = EnumPageJsonType.class, groups = {GroupsUpdateInterface.class,
            GroupsAddInterface.class})
    private String type;

    @NotNull(message = "isMainTable不能为空", groups = {GroupsUpdateInterface.class, GroupsAddInterface.class})
    @Schema(description = "是否主表")
    @ValidListValue(val = {0, 1}, groups = {GroupsUpdateInterface.class, GroupsAddInterface.class})
    private Integer isMainTable;

    @Schema(description = "排序")
    private Integer sort;
}
